package com.cloudsea.gateway;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.gateway.event.EnableBodyCachingEvent;
import org.springframework.context.ApplicationEventPublisher;

@SpringBootApplication
public class GatewayApplication implements InitializingBean {

	@Autowired
	private ApplicationEventPublisher publisher;

	public static void main(String[] args) {
		SpringApplication.run(GatewayApplication.class, args);
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		publisher.publishEvent(new EnableBodyCachingEvent("","cache_request_header_route"));
	}
}
